#ifndef CGTHREADWRAPPER_H
#define CGTHREADWRAPPER_H

class CGThreadWrapper
{
public:
  CGThreadWrapper(const gchar *threadName);
  virtual ~CGThreadWrapper();

  gboolean CreateThread(gboolean sync = TRUE);
  gboolean DestroyThread();
  gboolean IsThreadRunning() { return m_running; }

protected:
  static gpointer ThreadProc(gpointer params);
  virtual gulong RunThread();
  virtual gboolean RunLoop() { return TRUE; } /* return FALSE for exiting thtead */

protected:
  GThread *m_thread;                //!< thread handle
  CGEventWrapper m_event;           //!< creation sync event
  gboolean m_running;               //!< is running
  gchar *m_name;                    //!< thread name
  static gulong s_threadsRunnig;    //!< threads runnig
  static gulong s_threadsCreated;   //!< threads created
};

#endif // CGTHREADWRAPPER_H
